package org.jeecg.modules.online.cgform.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.lang.invoke.SerializedLambda;
import java.util.List;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.online.cgform.entity.OnlCgformIndex;
import org.jeecg.modules.online.cgform.mapper.OnlCgformHeadMapper;
import org.jeecg.modules.online.cgform.mapper.OnlCgformIndexMapper;
import org.jeecg.modules.online.cgform.service.IOnlCgformIndexService;
import org.jeecg.modules.online.cgform.utils.CgformUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("onlCgformIndexServiceImpl")
/* renamed from: org.jeecg.modules.online.cgform.service.a.e */
/* loaded from: hibernate-re-3.7.1-RC.jar:org/jeecg/modules/online/cgform/service/a/e.class */
public class OnlCgformIndexServiceImpl extends ServiceImpl<OnlCgformIndexMapper, OnlCgformIndex> implements IOnlCgformIndexService {

    /* renamed from: a */
    private static final Logger f457a = LoggerFactory.getLogger(OnlCgformIndexServiceImpl.class);
    @Autowired
    private OnlCgformHeadMapper onlCgformHeadMapper;

    /* renamed from: a */
//    private static /* synthetic */ Object m188a(SerializedLambda serializedLambda) {
//        String implMethodName = serializedLambda.getImplMethodName();
//        boolean z = true;
//        switch (implMethodName.hashCode()) {
//            case 713008857:
//                if (implMethodName.equals("getCgformHeadId")) {
//                    z = false;
//                    break;
//                }
//                break;
//        }
//        switch (z) {
//            case false:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformIndex") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformHeadId();
//                    };
//                }
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformIndex") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformHeadId();
//                    };
//                }
//                break;
//        }
//        throw new IllegalArgumentException("Invalid lambda deserialization");
//    }

    @Override // org.jeecg.modules.online.cgform.service.IOnlCgformIndexService
    public void createIndex(String code, String databaseType, String tbname, String synMethod) {
        String str;
        LambdaQueryWrapper<OnlCgformIndex> lambdaQueryWrapper = new LambdaQueryWrapper();
        lambdaQueryWrapper.eq((v0) -> {
            return v0.getCgformHeadId();
        }, code);
        List<OnlCgformIndex> list = list(lambdaQueryWrapper);
        if (list != null && list.size() > 0) {
            for (OnlCgformIndex onlCgformIndex : list) {
                if ((!CommonConstant.DEL_FLAG_1.equals(onlCgformIndex.getDelFlag()) && "N".equals(onlCgformIndex.getIsDbSynch())) || CgformUtil.f238J.equalsIgnoreCase(synMethod)) {
                    String indexName = onlCgformIndex.getIndexName();
                    String indexField = onlCgformIndex.getIndexField();
                    String str2 = CgformUtil.f239K.equals(onlCgformIndex.getIndexType()) ? " index " : onlCgformIndex.getIndexType() + " index ";
                    boolean z = true;
                    str = "create " + str2 + indexName + " on " + tbname + "(" + indexField + ")";
                    this.onlCgformHeadMapper.executeDDL(str);
                    onlCgformIndex.setIsDbSynch("Y");
                    updateById(onlCgformIndex);
                }
            }
        }
    }

    @Override // org.jeecg.modules.online.cgform.service.IOnlCgformIndexService
    public boolean isExistIndex(String countSql) {
        if (countSql == null) {
            return true;
        }
        Integer valueOf = Integer.valueOf(this.baseMapper.queryIndexCount(countSql));
        if (valueOf != null && valueOf.intValue() > 0) {
            return true;
        }
        return false;
    }

    @Override // org.jeecg.modules.online.cgform.service.IOnlCgformIndexService
    public List<OnlCgformIndex> getCgformIndexsByCgformId(String cgformId) {
        return  this.baseMapper.selectList(new LambdaQueryWrapper<OnlCgformIndex>().in(OnlCgformIndex::getCgformHeadId, new Object[]{cgformId}));
    }
}
